//
//  YearSelectedViewController.m
//  JiuLe
//
//  Created by SunChao on 16/11/9.
//  Copyright © 2016年 Fine. All rights reserved.
//

#import "YearSelectedViewController.h"

@interface YearSelectedViewController ()

@end

@implementation YearSelectedViewController
- (void)returnText:(ReturnTextBlock)block {
    self.returnTextBlock = block;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"服务年限";
    [self showNavgationWithLeftItemWithTitle:@"返回"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [[UITableViewCell alloc]init];
    NSDictionary *dic = [self.dataArray objectAtIndex:indexPath.row];
    
    cell.textLabel.text = [NSString stringWithFormat:@"%@年",[dic objectForKey:@"year_num"]];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.returnTextBlock != nil) {
        self.returnTextBlock([self.dataArray objectAtIndex:indexPath.row]);
    }
    [self.navigationController popViewControllerAnimated:YES];
}
@end
